home *** CD-ROM | disk | FTP | other *** search
/ Aminet 2 / Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso / Aminet / dev / misc / egs.lha / EGS / EGS_Devels / Examples / ASM / window.asm < prev    next >
Assembly Source File  |  1993-02-17  |  5KB  |  233 lines

  1. *
  2. *  window.asm -- Asm example that calls the EGS functions
  3. *
  4. *  Assemble with SASC assembler
  5. *
  6. *  $
  7. *  $ FILE     : window.asm
  8. *  $ VERSION  : 1
  9. *  $ REVISION : 20
  10. *  $ DATE     : 08-Feb-93 23:04
  11. *  $
  12. *  $ Author   : mvk
  13. *  $
  14. *
  15. *  This program is intended to open a EI_Window with
  16. *  a rectangle in it.
  17. *  It's only purpose is to show that the ASM includes work
  18. *
  19. *
  20. * (c) Copyright 1990/93 VIONA Development
  21. *     All Rights Reserved
  22. *
  23. *
  24.  
  25.    INCLUDE   "exec/types.i"
  26.    INCLUDE   "exec/macros.i"
  27.    INCLUDE   "exec/libraries.i"
  28.    INCLUDE   "exec/nodes.i"
  29.    INCLUDE   "exec/ports.i"
  30.  
  31.    INCLUDE   "egs/all.i"
  32.  
  33.    XDEF   _main
  34.  
  35.    XREF   _printf
  36.    XREF   _AbsExecBase
  37.  
  38.  
  39.    EXTERN_LIB   OpenLibrary
  40.    EXTERN_LIB   CloseLibrary
  41.    EXTERN_LIB   GetMsg
  42.    EXTERN_LIB   WaitPort
  43.    EXTERN_LIB   ReplyMsg
  44.  
  45.  
  46.  STRUCTURE  my_libs,0
  47.     APTR    my_egsgfx
  48.     APTR    my_egsintui
  49.     APTR    my_win
  50.     APTR    my_rast
  51.     APTR    my_port
  52.     APTR    my_msg
  53.     LABEL   my_SIZE
  54.  
  55.         section   code
  56.  
  57.  
  58. _main:
  59.    ;------ open the test library: this will load it from disk
  60.  
  61.         move.l   _AbsExecBase,a6
  62.         lea      -my_SIZE(a7),a7           ;Sturcture Memory
  63.         move.l   a7,a5
  64.         move.l   a7,myptr
  65.  
  66.         lea      egsintuiName(pc),a1
  67.         moveq    #0,d0
  68.         CALLLIB  _LVOOpenLibrary
  69.         move.l   d0,my_egsintui(a5)
  70.  
  71.         tst.l    d0
  72.         bne.s    1$
  73.  
  74.         ;------ couldn't find the library
  75.  
  76.         pea      egsintuiName(pc)
  77.         pea      nolibmsg(pc)
  78.         jsr      _printf
  79.         addq     #8,sp
  80.  
  81.         bra      main_end
  82. 1$:
  83.         lea      egsgfxName(pc),a1
  84.         moveq    #0,d0
  85.         CALLLIB  _LVOOpenLibrary
  86.         move.l   d0,my_egsgfx(a5)
  87.  
  88.         tst.l    d0
  89.         bne.s    2$
  90.  
  91.         ;------ couldn't find the library
  92.  
  93.         pea      egsgfxName(pc)
  94.         pea      nolibmsg(pc)
  95.         jsr      _printf
  96.         addq     #8,sp
  97.  
  98.         bra      main_end1
  99. 2$:
  100.         pea      egsintuiName(pc)
  101.         pea      Msg1(pc)
  102.         jsr      _printf
  103.         addq     #8,sp          ;fix 2 long stack pushes
  104.  
  105.         pea      egsgfxName(pc)
  106.         pea      Msg1(pc)
  107.         jsr      _printf
  108.         addq     #8,sp          ;fix 2 long stack pushes
  109.  
  110.         ;------ print the library name, version, and revision
  111.  
  112.         moveq    #0,d0
  113.  
  114.         pea      Msg2(pc)
  115.         jsr      _printf
  116.         addq     #4,sp          ;fix 1 long stack pushes
  117.  
  118.         ;------ call the first test function
  119.  
  120.         lea      mywin,a0
  121.  
  122.         LINKLIB  _LVOEI_OpenWindow,my_egsintui(a5)
  123.  
  124.         tst.l    d0
  125.         bne      3$
  126.  
  127.         pea      Msg4(pc)
  128.         jsr      _printf
  129.         addq     #4,sp          ;fix 1 long stack pushes
  130.  
  131.         bra      ende
  132. 3$:
  133.         move.l   d0,my_win(a5)
  134.         move.l   d0,a0
  135.         move.l   eiwi_UserPort(a0),my_port(a5)
  136.         move.l   eiwi_RPort(a0),my_rast(a5)
  137.  
  138.         move.l    my_rast(a5),a0
  139.         move.l    #$FF000000,d0             ;red
  140.         LINKLIB    _LVOEG_SetAPen,my_egsgfx(a5)
  141.  
  142.         move.l   my_rast(a5),a0
  143.         move.w   #50,d0
  144.         move.w   #50,d1
  145.         move.w   #100,d2
  146.         move.w   #100,d3
  147.         moveq    #0,d5
  148.  
  149.         LINKLIB   _LVOEG_RectFill,my_egsgfx(a5)
  150.  
  151. loop:
  152.         move.l    my_port(a5),a0
  153.         CALLLIB   _LVOWaitPort
  154.         move.l    my_port(a5),a0
  155.         CALLLIB   _LVOGetMsg
  156.         move.l    d0,my_msg(a5)
  157.         move.l    d0,a1
  158.         CALLLIB   _LVOReplyMsg
  159.  
  160.         move.l     my_msg(a5),a1
  161.         move.l    eims_Class(a1),d0
  162.         cmp.l     #EI_iCLOSEWINDOW,d0
  163.         bne       loop
  164.  
  165.         pea       Msg5(pc)
  166.         jsr       _printf
  167.         addq      #4,sp          ;fix 1 long stack pushes
  168.  
  169.         move.l    myptr,a5
  170.         move.l    my_win(a5),a0
  171.         LINKLIB   _LVOEI_CloseWindow,my_egsintui(a5)
  172.  
  173. ende:
  174.         move.l    myptr,a5
  175.         ;------ close the egsgfx.library
  176.         move.l    _AbsExecBase,a6
  177.         move.l    my_egsgfx(a5),a1
  178.         CALLLIB   _LVOCloseLibrary
  179.  
  180. main_end:
  181.         move.l    myptr,a5
  182.         ;------ close the egsintui.library
  183.         move.l    _AbsExecBase,a6
  184.         move.l    my_egsintui(a5),a1
  185.         CALLLIB   _LVOCloseLibrary
  186.  
  187. main_end1:
  188.         lea       my_SIZE(a7),a7
  189.         moveq     #0,d0
  190.         rts
  191.  
  192. myptr:       dc.l    0
  193.  
  194. mywin:       dc.w    100
  195.          dc.w    100
  196.          dc.w    350
  197.          dc.w    350
  198.          dc.w    200
  199.          dc.w    200
  200.          dc.w    3000
  201.          dc.w    3000
  202.          dc.l    0
  203.          dc.l    EI_WINDOWSIZE!EI_WINDOWCLOSE!EI_WINDOWBACK!EI_WINDOWDRAG
  204.          dc.l    0
  205.          dc.l    name
  206.          dc.l    0
  207.          dc.l    EI_iCLOSEWINDOW
  208.          dc.l    0
  209. color:
  210.          dc.l    0  ;1
  211.          dc.l    0  ;2
  212.          dc.l    0  ;3
  213.          dc.l    0  ;4
  214.          dc.l    0  ;5
  215.          dc.l    0  ;6
  216.          dc.l    0  ;8
  217.          dc.l    0  ;Menu
  218.          dc.l    0  ; Render
  219.  
  220. name:         dc.b   'Winddow',0
  221. egsgfxName:   dc.b   'egsgfx.library',0
  222. egsintuiName: dc.b   'egsintui.library',0
  223. nolibmsg:     dc.b   'Can not open library "%s"',10,0
  224. Msg1:         dc.b   'Open library "%s"',10,0
  225. Msg2:         dc.b   'Call EI_OpenWindw',10,0
  226. Msg4:         dc.b   'Cant Open Window',10,0
  227. Msg5:         dc.b   'Call EI_CloseWindow',10,0
  228.           cnop 4,0
  229.           END
  230.  
  231.  
  232.  
  233.